package com.yaorange.guild.association.controller;

import com.yaorange.guild.association.entity.Association;
import com.yaorange.guild.association.service.AssociationService;
import com.yaorange.response.Result;
import com.yaorange.response.enums.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 15332
 * @version 1.0
 * @date 2025/6/23 17:25
 * @description 协会信息控制器
 */
@RestController
@RequestMapping("/association")
public class AssociationController {
  @Autowired
  private AssociationService service;

  /**
   * 获取数据库中的数据信息
   */
  @GetMapping
  public Result getAssociation(){
    Association association = service.selectAssociation();
    return Result.success(association);
  }

  /**
   * 根据id进行更新保存
   */
  @PutMapping
  public Result updateAssociation(@RequestBody Association association){
    service.update(association);
    return Result.success(ResultCode.SUCCESS);
  }
}
